﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Quartz;

namespace House_Control
{
    //This class will handle everything dealing with Appliances in the house.
    public class Appliance
    {
        /* These constants will help with identifying the type of Appliance we are using, doing it this way is a bit cumbersome (espcially when adding new appliances to the system).
         * However, it seemed a lot easier than figuring out how to find out the instance of a particular thing in C# and it makes creating appliances easier.
         */
        public const int TELEVISION = 1;
        public const int DISHWASHER = 2;
        public const int LIGHT = 3;
        public const int PETSTATION = 4;
        public const int OVEN = 5;
        System.Windows.Forms.Button ex;
        //isOn will tell us wether the given appliance is on or not.
        bool isOn;
        //applianceType tells us what type of appliance we have. See the above constants for the appliance types.
        int applianceType;
        //schedule is the schedule object for this appliance, which can controll when an appliance is turned on / off.
        Schedule schedule;

        //Non-traditional appliance scheduler
        public Appliance()
        {
            isOn = false;
        }
        /* When instantating this class, use the constants above for type*/
        public Appliance(int type)
        {
            isOn = false;
            applianceType = type;
        }

        //This method will internally handle turning the appliance on / off with one method call.
        public void changeApplianceState()
        {
            if (isOn) isOn = false;
            else isOn = true;
        }

        public void setSchedule(int month, int day, int year, int hour, int min)
        {
            schedule = new Schedule(month, day, year, hour, min);
        }

        public void deleteSchedule()
        {
            schedule = null;
        }

        public int getApplianceType()
        {
            return applianceType;
        }

        //This method returns a string saying if the appliance is on or off.
        public string getApplianceStateString()
        {
            if (isOn) return "On";
            else return "Off";
        }

        //This method returns a true/false value for the on/off state of the appliance
        public bool getApplianceState()
        {
            return isOn;
        }
        public void setButton(System.Windows.Forms.Button b)
        {
            ex = b;
        }
        public System.Windows.Forms.Button getButton()
        {
            return ex;
        }
    }
}
